<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    登录
    <input type="text" id="user"><br>
    <input type="text" id="pass"><br>
    <button class="but">登录</button>

</body>
</html>
<script src="./ObjectAjax.js"></script>
<script>
    let ajax = new PublicUser()
    class Login{
        constructor({$,get,post}){
            this.$ = $
            this.get= get
            this.post =post
            this.init()
        }
        init(){
            let thas = this
            this.$(".but").onclick=e=>{
                thas.get({
                    url:"/login",
                    text:{
                        user:thas.$("#user").value,
                        pass:thas.$("#pass").value
                    },
                    callback(str){
                        console.log(str);
                        location.href= "http://localhost:3000/hom.html"

                    }
                })
            }
        }
    }
    new Login(ajax)

    
</script>